<template>
  <a-row :gutter="5">
    <a-col :span="4">
      <LeftTree @selected="getTreeData" icon-type="bars" :flag="4"></LeftTree>
    </a-col>
    <a-col :span="20">
      <a-card style="overflow: auto;height: 100%;">
        <div class="table-page-search-wrapper">
          <a-form layout="inline" @keyup.enter.native="searchQuery">
            <a-row :gutter="24">
              <a-col :md="6" :sm="8">
                <a-form-item label="标题">
                  <a-input placeholder="请输入" v-model="queryParam.title"></a-input>
                </a-form-item>
              </a-col>
              <a-col :md="6" :sm="8">
                <a-form-item label="颁布单位">
                  <a-input placeholder="请输入" v-model="queryParam.office"></a-input>
                </a-form-item>
              </a-col>
              <a-col :md="6" :sm="8">
                <a-form-item label="所属单位">
                  <j-select-depart v-model="queryParam.remid" :trigger-change="true" customReturnField="id"
                                   :multi="true"></j-select-depart>
                </a-form-item>
              </a-col>
              <a-col :md="6" :sm="8">
                <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
                  <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
                  <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">清除条件</a-button>
                  <!--                  <a @click="handleToggleSearch" style="margin-left: 8px">-->
                  <!--                    {{ toggleSearchStatus ? '收起' : '展开' }}-->
                  <!--                    <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>-->
                  <!--                  </a>-->
                </span>
              </a-col>
            </a-row>
          </a-form>
        </div>
        <!-- table区域-begin -->
        <div>
          <a-table
            ref="table"
            size="middle"
            bordered
            rowKey="id"
            :columns="columns"
            :dataSource="dataSource"
            :pagination="ipagination"
            :loading="loading"
            @change="handleTableChange">
            <span slot="title2" slot-scope="text">
              <j-ellipsis :value="text" :length="20"/>
            </span>
            <span slot="actionName">
              <a-button v-has="'sjzdbf:add'" size="small" @click="handleAdd('审计制度办法-新增')" type="primary" icon="plus">新增</a-button>
            </span>
            <span slot="action" slot-scope="text, record">
              <a v-has="'sjzdbf:detail'" @click="handleCheck(record,'审计制度办法-查看')">查看</a>
              <a-divider v-has="'sjzdbf:delete'" type="vertical"/>
              <a-dropdown v-has="'sjzdbf:delete'">
                <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
                <a-menu slot="overlay">
                    <a-menu-item v-has="'sjzdbf:edit'">
                      <a @click="handleEdit(record,'审计制度办法-编辑')">编辑</a>
                  </a-menu-item>
                  <a-menu-item v-has="'sjzdbf:delete'">
                    <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                      <a>删除</a>
                    </a-popconfirm>
                  </a-menu-item>
                </a-menu>
              </a-dropdown>
             </span>
          </a-table>
        </div>
        <!-- table区域-end -->
        <CheckAndEditModel ref="modalForm" @ok="modalFormOk"></CheckAndEditModel>
      </a-card>
    </a-col>
  </a-row>
</template>
<script>
  // 表头
  import LeftTree from '../../components/LeftTree'
  import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  import CheckAndEditModel from './CheckAndEditModel'
  import JEditor from '@/components/jeecg/JEditor'
  import columns from './indexColumns'

  export default {
    name: '审计制度办法',
    mixins: [JeecgListMixin],
    components: {
      LeftTree,
      CheckAndEditModel,
      JEditor
    },
    data() {
      return {
        queryParam: {},
        superParam: {
          advType: '4',
          cate: ''
        },
        // 表头
        columns: columns(this),
        url: {
          list: '/sjzszhly/knowledgeStation/queryStationListInfo',
          delete: '/sjzszhly/knowledgeStation/delete'
        },
      }
    },
    computed: {},
    methods: {
      getTreeData(data) {
        this.superParam.cate = data.id
        this.loadData(1);
      }
    },
    created() {
      if (this.$route.params && this.$route.params.title) {
        this.queryParam.title = this.$route.params.title
        this.loadData(1);
      }
    },
    mounted() {
      if (this.$route.params && this.$route.params.title) {
        setTimeout(() => {
          if (this.dataSource.length > 0) this.handleEdit(this.dataSource[0], '审计制度办法-编辑')
        }, 1000)
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>
<style lang="less" scoped>

  .ant-row {
    height: 100%;

    .ant-col {
      height: 100%;

      .ant-card {
        height: 100%;

        /deep/ .ant-card-body {
          padding: 15px;
        }
      }
    }
  }

</style>